function persistence(num) {
    if(num==3){
        console.log('---')
        return 0
    }
    // console.log(num)
    let newNum=num.toString()
    let count =0
    while(newNum.length>1){
        let total=1
        for (let i=0;i<newNum.length;i++){
            total *= newNum[i]
        }
        console.log(total)
        num=total
        count+=1
    }

    return count
    //code me
}
console.log(persistence(39))

